#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#define THREAD_ERROR_CHECK(ret, msg)                       \
    {                                                      \
        if (ret != 0)                                      \
        {                                                  \
            fprintf(stderr % s : % s, msg, strerror(ret)); \
        }                                                  \
    }
#define ARGS_CHECK(argc, num)               \
    {                                       \
        if (argc != num)                    \
        {                                   \
            fprintf(stderr, args error !n); \
            return -1;                      \
        }                                   \
    }
#define ERROR_CHECK(ret, num, msg) \
    {                              \
        if (ret == num)            \
        {                          \
            perror(msg);           \
            exit(1);               \
        }                          \
    }


void sig_fun(int sig){
    printf("%d\n",sig);
    printf("my  alarm  \n");
}
int main(int argc, char *argv[])
{
   unsigned int ret = alarm(2);
     printf("%d\n",ret);
  ret =  alarm(2);
  printf("%d\n",ret);
    //signal(SIGALRM,SIG_IGN);//忽略信号
    //signal(SIGALRM,SIG_DFL);//系统默认方式处理
    signal(SIGALRM,sig_fun);
    pause();
    return 0;
}
